import Router from "koa-router";
const router = new Router();
import { makeEntityKey, expireCache } from "../../proxy/redisProxy";

router.post("/_cmd/redis/clear/:entity,:key", async (ctx, next) => {
  const { entity, key } = ctx.params
  const k = makeEntityKey(entity)(key)
  
  const v = await expireCache(k)
  console.log(`expire key:${k}=>`, v)
  ctx.body = v;
});

export default router;